package logic

import (
	"context"
	"transaction/moder/mysql"

	"transaction/tranrpc/internal/svc"
	"transaction/tranrpc/tranrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUserDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserDelLogic {
	return &UserDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *UserDelLogic) UserDel(in *tranrpc.UserDelRequest) (*tranrpc.UserDelResponse, error) {
	// todo: add your logic here and delete this line
	var user mysql.User
	err := user.UserDel(mysql.DB, in.UserId)
	if err != nil {
		return nil, err
	}
	return &tranrpc.UserDelResponse{}, nil
}
